package twu.shubham.library;


public class BookRecord {

    private int currentAmount;
    private String bookName;
    private int actualAmount;
    public BookRecord(int amount, String bookName)
    {
           this.currentAmount = amount;
           this.bookName = bookName;
           this.actualAmount = amount;
    }

    public int bookPrint(int serialNo)
    {
        if(bookName.length() > 0)
        {
            System.out.println(serialNo +"\t\t" + bookName);
            return 1;
        }
        return 0;
    }

    public int reserveBook(int serialNo)
    {
        if(bookName.length() > 0)
        {
        if(currentAmount > 0)
        {
            System.out.println("Thank You, Your book has been reserved\n");
            System.out.println(serialNo +"\t"+bookName);
            currentAmount = currentAmount - 1;
            return 1;
        }
        System.out.println("This book is not available yet\n");
        return 0;
        }
        else
            System.out.println("Not a Valid book number\n");
            return 0;
    }

    public int returnBook() {
        if(currentAmount<actualAmount)
        {
            System.out.println("Thank you for returning the book");
            currentAmount = currentAmount + 1;
            return 1;
        }
        System.out.println("Sorry, we can't accept the book");
        return 0;
    }
}
